/*
 * TabbedPaneDelegate.h  0.4.0 / Dec 05, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef TABBEDPANEDELEGATE_H
#define TABBEDPANEDELEGATE_H

#include "Cute4jSwing.h"

#include "ContainerDelegate.h"

// TabbedPaneDelegate Class. ---------------------------------------------------

/*!
 * \brief TabbedPane Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT TabbedPaneDelegate : public ContainerDelegate
{
  Q_OBJECT
protected:
  TabbedPaneDelegate(JNIEnv *env, jobject obj);
public slots: // native calls
  void insertTab(JNIEnv *env, jlong tabDelegate, jint index, jstring title);
  void removeChild(JNIEnv *env, jlong childDelegate);
  void setTabPlacement(JNIEnv *env, jint tabPlacement);
  void setTabEnabled(JNIEnv *env, jint index, jboolean enabled);
  void setTabTitleText(JNIEnv *env, jint index, jstring titleText);
  void setTabToolTipText(JNIEnv *env, jint index, jstring toolTipText);
  void setTabWhatsThisText(JNIEnv *env, jint index, jstring whatsThisText);
  void setTabIcon(JNIEnv *env, jint index, jobject iconSet);
  void setCurrentIndex(JNIEnv *env, jint index);
public: // native calls
  static void initialize(JNIEnv *env, jclass cls);
  static jlong newInstance(JNIEnv *env, jobject obj);
public: // native callbacks
  void currentChanged(jint selectedIndex);
public:
  inline QTabWidget *qTabWidget() const;
protected slots:
  void currentChangedSlot(int index);
private:
  static jmethodID sm_currentChangedMID;
};

// TabbedPaneDelegate :: Public Inline Member Function. ------------------------

/*!
 * \brief Returns QTabWidget adaptee.
 *
 * \return QTabWidget adaptee
 */
inline QTabWidget *TabbedPaneDelegate::qTabWidget() const
{
  return static_cast<QTabWidget *>(qObject());
}

// Macro Definitions. ----------------------------------------------------------

#define TABBED_PANE_DELEGATE (reinterpret_cast<TabbedPaneDelegate *>(delegate))

#endif // TABBEDPANEDELEGATE_H
